package com.aigou.admin.aigouspringboot.controller.user;

import com.aigou.admin.aigouspringboot.common.LogScope;
import com.aigou.admin.aigouspringboot.entity.Brand;
import com.aigou.admin.aigouspringboot.result.Result;
import com.aigou.admin.aigouspringboot.service.BrandService;
import com.aigou.admin.aigouspringboot.utils.RandomUtil;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author Mr.LiFuXing
 * @Date 2024/12/10 20:22
 * @Title BrandController
 * @Package com.aigou.admin.aigouspringboot.controller
 */
@RestController("userBrand")
@RequestMapping("/user/brand")
@Slf4j
public class BrandController {

    @Resource
    private BrandService brandService;

    /**
     * 分页查询品牌列表
     *
     * @param current 当前页码
     * @return 包含品牌列表信息的分页结果对象
     */
    @GetMapping
    @LogScope(title = "品牌管理模块", content = "查看品牌列表信息")
    public Result select(@RequestParam Integer current) {

        log.info("查询第{}页的品牌信息", current);
        // 分页查询，返回PageInfo（分页插件工具）
        PageInfo<Brand> brandPageInfo = brandService.selectBrandListByPage(current);
        return Result.success(brandPageInfo);
    }
}